/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  dev
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
    format      ascii;
    class       dictionary;
    location    "system";
    object      createBafflesDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

// This is a sample configuration for creating baffles. Notes:
//
// - This utility usually converts internal faces into two boundary faces.
//
// - It can also convert boundary faces into a boundary face on a different
//   patch.
//
// - Faces are selected to make into baffles by specifying either a faceZone or
//   a surface.
//
// - Each selection requires two patches to be specified; the owner (or master)
//   and the neighbour (or slave).
//
// - Orientation matters. Internal faces will be split into two faces, and the
//   face that is oriented in the same direction as the zone or surface will be
//   added to the owner/master patch. The other face will be added to the
//   neighbour/slave patch. Boundary faces will be added to the owner patch if
//   they are oriented in the same direction as the zone or surface, and they
//   will be added to the neighbour patch otherwise.
//
// - Optionally, fields can also be modified. If the added patches are of
//   non-constrained type then patch-field entries must be provided for all
//   fields.
//

// Whether to convert internal faces only, and ignore any boundary faces that
// are in the selection
internalFacesOnly true;

// Whether to add patch fields to the field files
fields true;

// Baffles to create
baffles
{
    // Wall baffle example
    baffleFaces
    {
        // Use a surface to select faces and orientation.
        type        surface;
        surface     triSurface;
        name        baffle1D.stl;

        // Owner patch
        owner
        {
            name        baffleWall0;
            type        wall;

            // Patch field settings (can be omitted if fields = false)
            patchFields
            {
                p
                {
                    type        zeroGradient;
                }

                U
                {
                    type        noSlip;
                }
            }
        }

        // Neighbour patch. Use the same settings as for the owner.
        neighbour
        {
            name        baffleWall1;
            $owner;
        }
    }

    // Cyclic example
    cyclicFaces
    {
        // Use a zone to select faces and orientation
        type        faceZone;
        zoneName    cyclicFaces;

        // Owner patch
        owner
        {
            name        fan0;
            type        cyclic;
            neighbourPatch fan1;
            transform   none;

            // Patch field settings. Note U (and others) are not needed because
            // the patch that is being created is of constrained type, so the
            // fields can be constructed automatically. A field for p is given
            // here as it is an override (see the 'patchType' entry).
            patchFields
            {
                p
                {
                    type        fan;
                    patchType   cyclic;
                    jump        uniform 0;
                    value       uniform 0;
                    jumpTable   polynomial 1((100 0));
                }
            }
        }

        // Neighbour patch
        neighbour
        {
            name        fan1;
            type        cyclic;
            neighbourPatch fan0;
            transform   none;

            // Patch field settings
            patchFields
            {
                p
                {
                    type        fan;
                    patchType   cyclic;
                    value       uniform 0;
                }
            }
        }
    }
}


// ************************************************************************* //
